<template>
  <tl-sub-page :render="render" :visible.sync="visible" v-dialogDrag :title="title" :close-on-click-modal="false" class="tl-dialog" width="1000px" @open="open" @close="close" append-to-body>
    <tl-task ref="editForm" render="div" :projectinfo="projectinfo"></tl-task>
    <el-form class="tl-form taskForm" ref="form" :model="model" :rules="rules" label-width="150px" :disabled="disableEditSubmit">
      <el-row>
        <el-col :span="24">
          <el-form-item label="差距分析" prop="gapanalysis" :rules="rules.validateRequire">
            <el-input v-model="model.gapanalysis" type="textarea" :rows="4" maxlength="1000"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="改进计划" prop="managerplan" :rules="rules.validateRequire">
            <el-input v-model="model.managerplan" type="textarea" :rows="4" maxlength="1000"> </el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="doSubmitEdit" :loading="saveLoading" v-if="!disableEditSubmit"> <svg-icon icon-class="save" />保存 </el-button>
    </div>
  </tl-sub-page>
</template>

<script>
/** mixins */
import { mixin_edit } from '@tapui/mixins/mixin_edit'
import { formatDate } from '@tapui/utils/date'
/** 子组件 */
import tlTask from '../mpmProjectTask/edit'
/** 工具类 */
import { putAction, getAction, postAction, deleteAction } from '@tapui/utils/http'
/** VUE配置 */
export default {
  mixins: [mixin_edit],
  components: { tlTask },
  props: {
    render: {
      type: String,
      default: 'el-dialog'
    }
  },
  data() {
    return {
      moduleTitle: '差距与改进',
      urlPrefix: '/mpm/projectTaskFeedback/',
      url: {
        // 额外的url
      },
      projectinfo: {}
    }
  },
  methods: {
    assignDefaultValue() {
      if (this.isAdd) {
        this.$set(this.model, 'applyorgcode', this.org.code)
        this.$set(this.model, 'applyorgname', this.org.name)
        this.$set(this.model, 'applydeptcode', this.dept.code)
        this.$set(this.model, 'applydeptname', this.dept.fullname)
        this.$set(this.model, 'applyusercode', this.user.code)
        this.$set(this.model, 'applyusername', this.user.name)
        this.$set(this.model, 'usercode', this.user.code)
        this.$set(this.model, 'username', this.user.name)
        this.$set(this.model, 'deptcode', this.dept.code)
        this.$set(this.model, 'orgcode', this.org.code)
        this.$set(this.model, 'feedbackdate', new Date())
        this.$set(this.model, 'taskid', this.taskInfo.id)
        this.$set(this.model, 'taskname', this.taskInfo.taskname)
        this.$set(this.model, 'projectcode', this.taskInfo.projectcode)
        this.$set(this.model, 'istaskfeedback', '0')
        this.$set(this.model, 'state', 9)
        this.$set(this.model, 'submitdate', new Date())
      }
    },
    loaded() {
      this.$refs.editForm.id = this.taskInfo.id
      this.$refs.editForm.isAdd = false
      this.$refs.editForm.disableEditSubmit = true
      this.$refs.editForm.open()
    }
  }
}
</script>

<style lang="scss" scoped>
.taskForm {
  margin-top: 15px;
  margin-left: -50px;
  .el-row {
    margin-bottom: 2px;
  }
}
</style>
